package com.jinsi.service.impl;


import com.jinsi.mapper.StuDeferMapper;
import com.jinsi.pojo.ScStudentDefer;
import com.jinsi.service.StuDeferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StuDeferServiceImpl implements StuDeferService {
    @Autowired
    private StuDeferMapper mapper;
    @Override
    public void addDefer(ScStudentDefer defer) throws Exception {
        int num = mapper.addDefer(defer);
        if (num == 0){
            throw new Exception();
        }
    }

    @Override
    public List<ScStudentDefer> getDefers() {
        List<ScStudentDefer> list = mapper.getDefers();
        return list;
    }

    @Override
    public List<ScStudentDefer> getDeferByEndTime(Integer num) {
        List<ScStudentDefer> list = mapper.getDeferByEndTime(num);
        return list;
    }

    @Override
    public void delDefer(Integer id) throws Exception {
        int num = mapper.delDefer(id);
        if (num == 0) {
            throw new Exception();
        }
    }

    @Override
    public List<ScStudentDefer> getDeferByLikeIdAndName(Integer studentId, String studentName) {
        List<ScStudentDefer> list = mapper.getDeferByLikeIdAndName(studentId, studentName);
        return list;
    }
}
